<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html>
<head>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <title>基本设置</title>
    <meta name="keywords" content="*Sway*--后台管理系统">
    <meta name="description" content="*Sway*--后台管理系统">

    <link rel="shortcut icon" href="/favicon.ico">
    <link href="/Public/Admin/css/bootstrap.min14ed.css" rel="stylesheet">
    <link href="/Public/Admin/css/font-awesome.min93e3.css" rel="stylesheet">
    <link href="/Public/Admin/css/plugins/iCheck/custom.css" rel="stylesheet">
    <!-- Gritter -->
    <link href="/Public/Admin/js/plugins/gritter/jquery.gritter.css" rel="stylesheet">
    <!-- Morris -->
    <link href="/Public/Admin/css/plugins/morris/morris-0.4.3.min.css" rel="stylesheet">
    <link href="/Public/Admin/css/animate.min.css" rel="stylesheet">
    <link href="/Public/Admin/css/style.min862f.css" rel="stylesheet">
    <link href="/Public/Admin/css/plugins/switchery/switchery.css" rel="stylesheet">
</head>
<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5>基本设置</h5>
                </div>
                <div class="ibox-title">
                    <div class="col-sm-4"> </div>
                    <button class="btn btn-white buttonSwitch">站点配置</button>
                    <button class="btn btn-primary buttonSwitch">核心配置</button>
                    <button class="btn btn-primary buttonSwitch">邮箱配置</button>
                    <button class="btn btn-primary buttonSwitch">附件配置</button>
                    <button class="btn btn-primary buttonSwitch">会员整合</button>
                </div>
                <div class="ibox-content">
                    <form class="form-horizontal m-t" id="Forma" enctype="multipart/form-data" action="<?php echo U('Admin/admin/Save');?>">
                        <div class="ibox-content divSwitch" style="display: block;">
                            <div class="form-group">
                                <label class="col-sm-3 control-label">参数说明</label>
                                <div class="col-sm-6">
                                    <label class="col-sm-6 control-label">参数值</label>
                                </div>
                                <div class="col-sm-3">变量名</div>
                            </div>
                            <?php if(is_array($configInfo)): $i = 0; $__LIST__ = $configInfo;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$v): $mod = ($i % 2 );++$i; if($v["group_id"] == 0): ?><div class="hr-line-dashed"></div>
                                    <div class="form-group">
                                        <label class="col-sm-3 control-label"><?php echo ($v["title"]); ?>:</label>
                                        <div class="col-sm-6">
                                            <input id="<?php echo ($v["variable"]); ?>" name="<?php echo ($v["variable"]); ?>" class="form-control" value="<?php echo ($v["value"]); ?>" type="text">
                                            <span class="help-block m-b-none"></span>
                                        </div>
                                        <div class="col-sm-3"><?php echo ($v["variable"]); ?></div>
                                    </div><?php endif; endforeach; endif; else: echo "" ;endif; ?>
                        </div>
                        <div class="ibox-content divSwitch" style="display: none;">
                            <?php if(is_array($configInfo)): $i = 0; $__LIST__ = $configInfo;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$v): $mod = ($i % 2 );++$i; if($v["group_id"] == 1): ?><div class="hr-line-dashed"></div>
                                    <div class="form-group">
                                        <label class="col-sm-3 control-label"><?php echo ($v["title"]); ?>:</label>
                                        <div class="col-sm-6">
                                            <input id="<?php echo ($v["variable"]); ?>" name="<?php echo ($v["variable"]); ?>" class="form-control" value="<?php echo ($v["value"]); ?>" type="text">
                                            <span class="help-block m-b-none"></span>
                                        </div>
                                        <div class="col-sm-3"><?php echo ($v["variable"]); ?></div>
                                    </div><?php endif; endforeach; endif; else: echo "" ;endif; ?>
                        </div>
                        <div class="ibox-content divSwitch" style="display: none;">
                            <?php if(is_array($configInfo)): $i = 0; $__LIST__ = $configInfo;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$v): $mod = ($i % 2 );++$i; if($v["group_id"] == 2): ?><div class="hr-line-dashed"></div>
                                    <div class="form-group">
                                        <label class="col-sm-3 control-label"><?php echo ($v["title"]); ?>:</label>
                                        <div class="col-sm-6">
                                            <input id="<?php echo ($v["variable"]); ?>" name="<?php echo ($v["variable"]); ?>" class="form-control" value="<?php echo ($v["value"]); ?>" type="text">
                                            <span class="help-block m-b-none"></span>
                                        </div>
                                        <div class="col-sm-3"><?php echo ($v["variable"]); ?></div>
                                    </div><?php endif; endforeach; endif; else: echo "" ;endif; ?>
                        </div>
                        <div class="ibox-content divSwitch" style="display: none;">
                            <?php if(is_array($configInfo)): $i = 0; $__LIST__ = $configInfo;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$v): $mod = ($i % 2 );++$i; if($v["group_id"] == 3): ?><div class="hr-line-dashed"></div>
                                    <div class="form-group">
                                        <label class="col-sm-3 control-label"><?php echo ($v["title"]); ?>:</label>
                                        <div class="col-sm-6">
                                            <input id="<?php echo ($v["variable"]); ?>" name="<?php echo ($v["variable"]); ?>" class="form-control" value="<?php echo ($v["value"]); ?>" type="text">
                                            <span class="help-block m-b-none"></span>
                                        </div>
                                        <div class="col-sm-3"><?php echo ($v["variable"]); ?></div>
                                    </div><?php endif; endforeach; endif; else: echo "" ;endif; ?>
                        </div>
                        <div class="ibox-content divSwitch" style="display: none;">
                            <?php if(is_array($configInfo)): $i = 0; $__LIST__ = $configInfo;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$v): $mod = ($i % 2 );++$i; if($v["group_id"] == 4): ?><div class="hr-line-dashed"></div>
                                    <div class="form-group">
                                        <label class="col-sm-3 control-label"><?php echo ($v["title"]); ?>:</label>
                                        <div class="col-sm-6">
                                            <input id="<?php echo ($v["variable"]); ?>" name="<?php echo ($v["variable"]); ?>" class="form-control" value="<?php echo ($v["value"]); ?>" type="text">
                                            <span class="help-block m-b-none"></span>
                                        </div>
                                        <div class="col-sm-3"><?php echo ($v["variable"]); ?></div>
                                    </div><?php endif; endforeach; endif; else: echo "" ;endif; ?>
                        </div>

                        <div class="hr-line-dashed"></div>
                        <div class="form-group">
                            <div class="col-sm-8 col-sm-offset-3">
                                <button class="btn btn-primary" type="submit">提交</button>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
<script src="/Public/Admin/js/jquery.min.js"></script>
<script src="/Public/Admin/js/bootstrap.min.js"></script>
<script src="/Public/Admin/js/plugins/layer.3/layer.js"></script>
<script src="/Public/Admin/js/common.js"></script>
<script src="/Public/Admin/js/content.min.js"></script>
<script src="/Public/Admin/js/plugins/validate/jquery.validate.min.js"></script>
<script src="/Public/Admin/js/plugins/validate/messages_zh.min.js"></script>
<script src="/Public/Admin/js/plugins/switchery/switchery.js"></script>
<script>
    $(function(){
        //初始化Checkbox按钮样式
        var elem = document.querySelector('.js-switch');
        var init = new Switchery(elem);



        $('.buttonSwitch').click(function(){
            $(this).removeClass('btn-primary').addClass('btn-white').siblings('.buttonSwitch').removeClass('btn-white').addClass('btn-primary');
            var num = $(this).index();
            $('.divSwitch').eq(num-1).css('display', 'block').siblings('.divSwitch').css('display', 'none');
        });


        var data = new  FormData(document.getElementById('Forma'));
        $.ajax({
            url:$(form).attr('action'),
            type:"POST",
            data:data,
            cache: false,
            processData:false,
            contentType:false,
            success:function(data){
                if(data.status > 0){
                    common.error(data.msg);
                }else{
                    common.success(data.msg,"<?php echo U('Admin/admin/index');?>");
                }
            },
            dataType:'JSON'
        });
    });
</script>
</body>
</html>